pageScope

Purpose

A reference to the binding of the GSP that the tag library is being executed within. Allows access to variables set with the set tag and those passed to the page via the controller model.

Examples

class BookTagLib {
   def parent = { attrs, body ->
       pageScope.parent = "John"
       out << body()
   }
   def child = { attrs, body ->
       out << "My parent is ${pageScope.parent}"
   }
}

<g:parent>
    <g:child /> // Outputs "My parent is John"
</g:parent>

Description

The pageScope variable contains a reference to the underlying model being manipulated by the page. It can also be used to pass variables from parent to child tags.